Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add name_prefix support to aws_cloudwatch_log_group #13273

Merged
merged 1 commit into from
Apr 16, 2017
Merged

Add name_prefix support to aws_cloudwatch_log_group #13273

merged 1 commit into from
Apr 16, 2017

Conversation

joshuaspence
Copy link
Contributor

Adds name_prefix support to the aws_cloudwatch_log_group resource.

@joshuaspence
Copy link
Contributor Author

> make test TEST='./builtin/providers/aws' TESTARGS='-run=TestValidateLogGroup\(Name\|NamePrefix\)'==> Checking that code complies with gofmt requirements...
==> Checking AWS provider for unchecked errors...
==> NOTE: at this time we only look for uncheck errors in the AWS package
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/02 15:10:26 Generated command/internal_plugin_list.go
go test -i ./builtin/providers/aws || exit 1
echo ./builtin/providers/aws | \
    xargs -t -n4 go test -run=TestValidateLogGroup\(Name\|NamePrefix\) -timeout=60s -parallel=4
go test -run=TestValidateLogGroup(Name|NamePrefix) -timeout=60s -parallel=4 ./builtin/providers/aws 
ok      github.com/hashicorp/terraform/builtin/providers/aws    0.019s

> make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSCloudWatchLogGroup_\(namePrefix\|generatedName\)'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/02 14:43:59 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSCloudWatchLogGroup_\(namePrefix\|generatedName\) -timeout 120m
=== RUN   TestAccAWSCloudWatchLogGroup_namePrefix
--- PASS: TestAccAWSCloudWatchLogGroup_namePrefix (39.47s)
=== RUN   TestAccAWSCloudWatchLogGroup_generatedName
--- PASS: TestAccAWSCloudWatchLogGroup_generatedName (38.53s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    78.035s

Copy link
Contributor

@stack72 stack72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 pending point inline atm

@@ -49,10 +58,19 @@ func resourceAwsCloudWatchLogGroup() *schema.Resource {
func resourceAwsCloudWatchLogGroupCreate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).cloudwatchlogsconn

log.Printf("[DEBUG] Creating CloudWatch Log Group: %s", d.Get("name").(string))
var logGroupName string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm starting to think we should refactor this type of code into a common structure fund - it is repeated in a lot of places now - thoughts?

We could pass name, name_prefix and return the formatted value

Thoughts?

@stack72
Copy link
Contributor

stack72 commented Apr 16, 2017

LGTM! Left 1 minor point inline but nothing to stop the merge

Thanks, as usual :)

% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSCloudWatchLogGroup'                                        ✭
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/17 01:44:49 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSCloudWatchLogGroup -timeout 120m
=== RUN   TestAccAWSCloudWatchLogGroup_importBasic
--- PASS: TestAccAWSCloudWatchLogGroup_importBasic (29.63s)
=== RUN   TestAccAWSCloudWatchLogGroup_basic
--- PASS: TestAccAWSCloudWatchLogGroup_basic (26.32s)
=== RUN   TestAccAWSCloudWatchLogGroup_namePrefix
--- PASS: TestAccAWSCloudWatchLogGroup_namePrefix (26.49s)
=== RUN   TestAccAWSCloudWatchLogGroup_generatedName
--- PASS: TestAccAWSCloudWatchLogGroup_generatedName (24.53s)
=== RUN   TestAccAWSCloudWatchLogGroup_retentionPolicy
--- PASS: TestAccAWSCloudWatchLogGroup_retentionPolicy (48.07s)
=== RUN   TestAccAWSCloudWatchLogGroup_multiple
--- PASS: TestAccAWSCloudWatchLogGroup_multiple (28.78s)
=== RUN   TestAccAWSCloudWatchLogGroup_disappears
--- PASS: TestAccAWSCloudWatchLogGroup_disappears (19.36s)
=== RUN   TestAccAWSCloudWatchLogGroup_tagging
--- PASS: TestAccAWSCloudWatchLogGroup_tagging (49.35s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	252.567s

@stack72 stack72 merged commit 8d5fdea into hashicorp:master Apr 16, 2017
@ghost
Copy link

ghost commented Apr 14, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants